package com.it.vo;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.util.Collection;

/**
 * TODO
 *
 * @author: Coke
 * @DateTime: 2023/11/08/19:16
 **/
public class SecurityUser implements UserDetails {
    
    // 用户的权限
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities () {
        return null;
    }
    
    @Override
    public String getPassword () {
        return new BCryptPasswordEncoder().encode("123456");
    }
    
    @Override
    public String getUsername () {
        return "张三";
    }
    
    // 判断帐号是否已经过期
    @Override
    public boolean isAccountNonExpired () {
        return true;
    }
    
    // 判断帐号是否已被锁定
    @Override
    public boolean isAccountNonLocked () {
        return true;
    }
    // 判断用户凭证是否已经过期
    @Override
    public boolean isCredentialsNonExpired () {
        return true;
    }
    
    // 是否有效
    @Override
    public boolean isEnabled () {
        return true;
    }
}
